package com.ruoyi.web.controller.admin;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.HospitalSubscribeGroupPurchaseInspectionResults;
import com.ruoyi.system.service.IHospitalSubscribeGroupPurchaseInspectionResultsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 团队订单检查项目结果Controller
 * 
 * @author ruoyi
 * @date 2025-06-12
 */
@RestController
@RequestMapping("/admin/group/purchase/inspection/results")
public class HospitalSubscribeGroupPurchaseInspectionResultsAdminController extends BaseController
{
    @Autowired
    private IHospitalSubscribeGroupPurchaseInspectionResultsService hospitalSubscribeGroupPurchaseInspectionResultsService;

    /**
     * 查询团队订单检查项目结果列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HospitalSubscribeGroupPurchaseInspectionResults hospitalSubscribeGroupPurchaseInspectionResults)
    {
        startPage();
        List<HospitalSubscribeGroupPurchaseInspectionResults> list = hospitalSubscribeGroupPurchaseInspectionResultsService.selectHospitalSubscribeGroupPurchaseInspectionResultsList(hospitalSubscribeGroupPurchaseInspectionResults);
        return getDataTable(list);
    }

    /**
     * 导出团队订单检查项目结果列表
     */
    @Log(title = "团队订单检查项目结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HospitalSubscribeGroupPurchaseInspectionResults hospitalSubscribeGroupPurchaseInspectionResults)
    {
        List<HospitalSubscribeGroupPurchaseInspectionResults> list = hospitalSubscribeGroupPurchaseInspectionResultsService.selectHospitalSubscribeGroupPurchaseInspectionResultsList(hospitalSubscribeGroupPurchaseInspectionResults);
        ExcelUtil<HospitalSubscribeGroupPurchaseInspectionResults> util = new ExcelUtil<HospitalSubscribeGroupPurchaseInspectionResults>(HospitalSubscribeGroupPurchaseInspectionResults.class);
        util.exportExcel(response, list, "团队订单检查项目结果数据");
    }

    /**
     * 获取团队订单检查项目结果详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(hospitalSubscribeGroupPurchaseInspectionResultsService.selectHospitalSubscribeGroupPurchaseInspectionResultsById(id));
    }

    /**
     * 新增团队订单检查项目结果
     */
    @Log(title = "团队订单检查项目结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HospitalSubscribeGroupPurchaseInspectionResults hospitalSubscribeGroupPurchaseInspectionResults)
    {
        return toAjax(hospitalSubscribeGroupPurchaseInspectionResultsService.insertHospitalSubscribeGroupPurchaseInspectionResults(hospitalSubscribeGroupPurchaseInspectionResults));
    }

    /**
     * 修改团队订单检查项目结果
     */
    @Log(title = "团队订单检查项目结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HospitalSubscribeGroupPurchaseInspectionResults hospitalSubscribeGroupPurchaseInspectionResults)
    {
        return toAjax(hospitalSubscribeGroupPurchaseInspectionResultsService.updateHospitalSubscribeGroupPurchaseInspectionResults(hospitalSubscribeGroupPurchaseInspectionResults));
    }

    /**
     * 删除团队订单检查项目结果
     */
    @Log(title = "团队订单检查项目结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(hospitalSubscribeGroupPurchaseInspectionResultsService.deleteHospitalSubscribeGroupPurchaseInspectionResultsByIds(ids));
    }
}
